/**
 * FileName: MyConfig2
 * Author:   xing.yang@vcg.com
 * Date:     2020/6/2 16:03
 * Description:
 */
package com.vcg.vdam.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyConfig2 {

    @Bean
    @ConditionalOnProperty(prefix = "test.yx",name = "age",havingValue = "23")
    public Grade findGrad2(){
        Grade grade = new Grade();
        grade.setGradeString("2017级");
        return grade;
    }

    @Bean
    @ConditionalOnMissingBean
    public Grade findGrad(){
        Grade grade = new Grade();
        grade.setGradeString("2016级");
        return grade;
    }
}
